<script lang="ts" setup>
    import {reactive, ref} from "vue";

    let Person=ref({name:"爱上hxd",age:66});
    // let checkStat=ref(true);
    // let inputText=ref("");
    // let selectValue=ref(2);
    let Val=ref({
        checkStat:true,
        inputText:"",
        selectValue:2,
        isCheck:true
    })
    function ischange(){
        if(Val.value.checkStat){
            alert("已选中");
            Person.value.name="爱上hxd";
        }else{
            alert("未选中");
            Person.value.name="不爱hxd";
        }
    }
    function changes(e:Event){
        Val.value.isCheck = (e.target as HTMLInputElement).checked;
        alert("鑫达宝宝")
    }
</script>

<template>
    <h2>Person:{{ Person.name }}{{ Person.age }}</h2>
    <input type="checkbox" v-model="Val.checkStat" @change="ischange">是否爱
    <input type="text" v-model="Val.inputText">
    <select v-model="Val.selectValue">
        <option>1</option>
        <option>2</option>
    </select><br>

    <input type="checkbox" :checked="Val.isCheck" @change="changes">是否
</template>

<style scoped>

</style>